import request from '/@/utils/request';
import { paramsSerializer } from '/@/utils/sort';

// 菜单列表
export const menuList = (params?: object) => {
  return request({
    url: 'api/v1/admins/menu',
    method: 'get',
    params,
    paramsSerializer
  })
}

// 菜单详情
export const menuDetail = (id: number) => {
  return request({
    url: `api/v1/admins/menu/${id}`,
    method: 'get',
  })
}

// 新增菜单
export const addMenu = (data: Object) => {
  return request({
    url: `api/v1/admins/menu`,
    method: 'post',
    data
  })
}

// 修改菜单
export const updateMenu = (data: Object) => {
  return request({
    url: `api/v1/admins/menu`,
    method: 'put',
    data
  })
}

// 删除菜单
export const deleteMenu = (id: number) => {
  return request({
    url: `api/v1/admins/menu/${id}`,
    method: 'delete'
  })
}
